// 指定参数类型
function fn1 (name:string, age:number) {}
fn1('22', 222)
// fn1(false, number) 错误


// 参数可选
function fn2(name:string, age?:number){}
fn2('222')


// 参数默认
function fn3(name: string, age:number = 22){}
fn3('hellow')

// 参数剩余
function fn4(name: string, ...data:object[]){}
fn4('1223', {state: false, age: 22} )


// 返回指定类型
function fn5():string{
    let a = 2;
    return 'str' + (a * 5)/a
} 


// 函数类型 
let f6:(name: string, age: number) => string
f6 = function(name:string, age:number):string {
    return '222'
}
f6('2', 2)

let fn7:(name: string, age:number) => string = function(name: string, age: number):string{
    return '222'
}
fn7('2', 222)












export {}